package com.happy016.mapper.provider;


import com.happy016.entity.user.User;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.jdbc.SQL;

public class UserProvider {

    public String findSelf2(User user){

        return new SQL(){
            {
                SELECT( "*");
                FROM("t_user");
                if(StringUtils.isNotBlank(user.getUsername())){
                    WHERE("username like concat('%',#{username},'%')");
                }
                if(user.getStatus() != null){
                    WHERE("status = #{status}");
                }
                ORDER_BY("createTime desc");
            }
        }.toString();
    }
}
